/*
https://leetcode.cn/problems/kth-missing-positive-number/submissions/564894009/
力扣1539. 第 k 个缺失的正整数
*/
class Solution {

public:

    int findKthPositive(vector<int>& arr, int k) {//下界查找
        int left = 0,right = arr.size()-1;
        while(left <= right){
            int mid = left + (right-left)/2;
            if(arr[mid]-mid-1 >= k)
                right = mid-1;
            else
                left = mid+1;
        }

    return left+k;

    }

};